package com.zxj.controller;


import com.seventh.common.pojo.R;
import com.zxj.pojo.entity.TbCarType;
import com.zxj.pojo.vo.TypeVo;
import com.zxj.service.CarTypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-fifth
 * @description:
 * @author: 张修杰
 * @create: 2021-07-23 22:38
 **/
@RestController
@RequestMapping("lease/carType")

public class CarTypeController {
    @Resource
    CarTypeService carTypeService;
    @ApiOperation(value = "初始化汽车类型查询信息")
    @PostMapping("initCarTypeTable/{currentPage}/{pageSize}")
    public R initCarTypeTable(@PathVariable("currentPage") Integer currentPage,
                              @PathVariable("pageSize") Integer pageSize,
                              @RequestBody TypeVo typeVo){
        return carTypeService.findAllCarTypePage(currentPage,pageSize,typeVo);
    }
    @ApiOperation(value = "修改汽车信息")
    @PutMapping("updateCarTypeById")
    public R updateCarById(@RequestBody TbCarType tbCarType){
        return carTypeService.updateCarTypeById(tbCarType);
    }

    @ApiOperation(value = "修改回显 汽车信息")
    @GetMapping("selectCarTypeById/{id}")
    public R selectCarTypeById(@PathVariable String id){
        return carTypeService.selectCarTypeById(id);
    }
    @ApiOperation(value = "新增汽车信息")
    @PutMapping("insertCarType")
    public R insertCarType(@RequestBody TbCarType tbCarType){
        return carTypeService.insertCarType(tbCarType);
    }
    @ApiOperation(value = "删除汽车信息")
    @GetMapping("deleteCarType/{id}")
    public R deleteCarType(@PathVariable String id){
        return carTypeService.deleteCarType(id);
    }
    @GetMapping("selectAllCarType")
    public R selectAllCarType(){ return carTypeService.selectAllCarType();}
}
